Image:boot.bin head.bin

boot.bin:boot.c boot.s
	gcc -c -m32 boot.c -o bootc.o
	as --32 boot.s -o boots.o
	ld -Ttext 0x7c00 -m elf_i386 boots.o bootc.o -o boot.elf
	objcopy -j .text -j .rodata -j .data -O binary boot.elf boot.bin
	./flag.sh
	dd if=tmp of=boot.bin ibs=1 obs=1 seek=510 count=2
	rm tmp
	dd if=boot.bin of=kernel.img bs=512 count=1 conv=notrunc

head.bin:head.c head.s
	gcc -c -m32 head.c -o headc.o
	as --32 head.s -o heads.o
	ld -Ttext 0x00 -m elf_i386 heads.o headc.o -o head.elf
	objcopy -j .text -j .data -j .rodata -O binary head.elf head.bin
	dd if=head.bin of=kernel.img cbs=512 seek=1 conv=notrunc

disb:
	objdump -D -m i8086 -b binary boot.bin

dish:
	objdump -D -m i8086 -b binary head.bin

clean:
	rm -rf *.o *.bin *.elf *.log